// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Fluent;
using Elastic.Clients.Elasticsearch.Serialization;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement;

public sealed partial class ForceMergeAction
{
	[JsonInclude, JsonPropertyName("index_codec")]
	public string? IndexCodec { get; set; }
	[JsonInclude, JsonPropertyName("max_num_segments")]
	public int MaxNumSegments { get; set; }
}

public sealed partial class ForceMergeActionDescriptor : SerializableDescriptor<ForceMergeActionDescriptor>
{
	internal ForceMergeActionDescriptor(Action<ForceMergeActionDescriptor> configure) => configure.Invoke(this);

	public ForceMergeActionDescriptor() : base()
	{
	}

	private string? IndexCodecValue { get; set; }
	private int MaxNumSegmentsValue { get; set; }

	public ForceMergeActionDescriptor IndexCodec(string? indexCodec)
	{
		IndexCodecValue = indexCodec;
		return Self;
	}

	public ForceMergeActionDescriptor MaxNumSegments(int maxNumSegments)
	{
		MaxNumSegmentsValue = maxNumSegments;
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
		writer.WriteStartObject();
		if (!string.IsNullOrEmpty(IndexCodecValue))
		{
			writer.WritePropertyName("index_codec");
			writer.WriteStringValue(IndexCodecValue);
		}

		writer.WritePropertyName("max_num_segments");
		writer.WriteNumberValue(MaxNumSegmentsValue);
		writer.WriteEndObject();
	}
}